package com.taotao.delayjob.core.model;

import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.taotao.delayjob.core.constant.RetryBusiCode;
import com.taotao.delayjob.core.constant.RetryStatus;
import com.taotao.common.enums.EnumField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 任务重试实例
 *
 * @author Fan Beibei
 * @date 2024-07-17 10:22:25
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class RetryInstPageData implements Serializable {
    @ApiModelProperty(value="主键")
    private Long id;
    @EnumField(RetryBusiCode.class)
    @ApiModelProperty(value="业务类型编码")
    private String busiCode;
    @ApiModelProperty(value="业务编号")
    private String busiNo;
    @ApiModelProperty(value="业务参数")
    private String param;
    @ApiModelProperty(value="最大重试次数")
    private Integer maxNum;
    @ApiModelProperty(value="当前重试次数")
    private Integer curNum;
    @ApiModelProperty(value="首次重试延迟时间（秒）")
    private Integer firstDelay;
    @ApiModelProperty(value="重试间隔时间（秒）")
    private Integer intervalSeconds;
    @ApiModelProperty(value="下次重试时间")
    private Long nextTriggerTime;
    @EnumField(RetryStatus.class)
    @ApiModelProperty(value="当前执行状态:not_success-未成功;success-成功")
    private String status;
    @ApiModelProperty(value="备注")
    private String note;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value="创建时间")
    private LocalDateTime createTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value="更新时间")
    private LocalDateTime updateTime;

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

}